<!-- Copyright 2013 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Author:  koto@google.com (Krzysztof Kotowicz)
// Author:  kbsriram@gmail.com (KB Sriram) - a few testcases
// -->
<!DOCTYPE html>
<title>Unit Test of e2e.block.TransferableKey</title>
<script src="../../../../../../javascript/closure/base.js"></script>
<script src="test_js_deps-runfiles.js"></script>
<script>
  goog.require('goog.array');
  goog.require('goog.testing.jsunit');
  goog.require('goog.testing.AsyncTestCase');
  goog.require('e2e.openpgp.block.all');
  goog.require('e2e.openpgp.block.factory');
  goog.require('e2e.openpgp.packet.all');
  goog.require('e2e.cipher.all');
  goog.require('e2e.signer.all');
 </script>

<!--
Public key block containing a signing subkey (with binding 0x19 signature)
:public key packet:
  version 4, algo 1, created 1408612889, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:user ID packet: "signing-subkey <signing-subkey@example.com>"
:signature packet: algo 1, keyid 6A69A7100F8C5C47
  version 4, created 1408612889, md5len 0, sigclass 0x13
  digest algo 2, begin of digest e9 eb
  hashed subpkt 2 len 4 (sig created 2014-08-21)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 2 (pref-zip-algos: 2 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID 6A69A7100F8C5C47)
  data: [1024 bits]
:public sub key packet:
  version 4, algo 1, created 1408612889, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid 6A69A7100F8C5C47
  version 4, created 1408612889, md5len 0, sigclass 0x18
  digest algo 2, begin of digest b1 7c
  hashed subpkt 2 len 4 (sig created 2014-08-21)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID 6A69A7100F8C5C47)
  data: [1024 bits]
:public sub key packet:
  version 4, algo 1, created 1408612974, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid 6A69A7100F8C5C47
  version 4, created 1408612974, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 93 5a
  hashed subpkt 2 len 4 (sig created 2014-08-21)
  hashed subpkt 27 len 1 (key flags: 02)
  subpkt 16 len 8 (issuer key ID 6A69A7100F8C5C47)
  subpkt 32 len 156 (signature: v4, class 0x19, algo 1, digest algo 2)
  data: [1021 bits]
-->
<textarea id="SigningSubkey">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mI0EU/W6GQEEALr7DpMdrxW2/X1GTepEeABgojRLY7TdGBGR6r7VWzmKh2agQdAC
FyvBcRb/tGwwZmimxyxsws7o+2h3oaM8GL0OQ9WEi1035G5DQweHM989Yw84Dj1O
WeXZxRKAqU93+rEz6xys9BYteqL6SNyNt29EjZ7W+mRtWCRUxViaJhGhABEBAAG0
K3NpZ25pbmctc3Via2V5IDxzaWduaW5nLXN1YmtleUBleGFtcGxlLmNvbT6ItwQT
AQIAIQUCU/W6GQIbAwYLCQgHAwIGFQgCCQoLAxYCAQIeAQIXgAAKCRBqaacQD4xc
R+nrBACSTSve7hlxRONletyvDIeQWewQi6ePXkPGWElPrvf8BjEynDMsJHJiDblO
rv0uvpELS2v+OvzJLGD97arenkfWq7PTp7Lm/CWdrJmvCFTZc2gUyTtxMExre2co
uTpfsUNwZudQwe/n9X9oQ0gAXyT79puJ44SqJ5rB2iQj97YOtbiNBFP1uhkBBACi
80AIcHy8YG2UrfCEy+pThYBJxevsS34ne4jwPQFvQe6XULojujaZ8mUmQ3QeNLhS
oBS6q3zhE/FCSpbjt6IWTmYqXz4gH1AGxCv3kEfUc4s1iVj2/u9lNP7Sh7nzNlFp
mfy59uxn4bS1qXf0K6bVIJMj2T3Aq73bOyk/DWvUqwARAQABiJ8EGAECAAkFAlP1
uhkCGwwACgkQammnEA+MXEexfAQAo7wANLUBF9SMKsoGtMZGgIHXpc27E25Nr2IN
/du5mM7MvJXz7wSU8upw89q2g2LvmpoxMshWfw1hRLR92KIzNEb6HFt/WfIxLBeO
RKLu+kETTWN4cnbU8Rtg8Rvw7OY92/vnvwjv1HXXF2qAbf+Lj0Jy7e6h7C+dAXfS
ZdLlE924jQRT9bpuAQQApdRMs7l2uCQtQOg2qRyoUbQdkaCj+6ON5hvN7swUkLaN
zOT6E0V+mQUjHDbnbS8U3sFEyOwciNvzt1KRKUhsZFN4xaPSYXECw1JQMcZczZ2w
9OOcJrVLpJFrv5cQFrx5X9jfTWePXuC40rXzPZ/RvggSMSlW+dWeFPFA2OYszOkA
EQEAAYkBPQQYAQIACQUCU/W6bgIbAgCoCRBqaacQD4xcR50gBBkBAgAGBQJT9bpu
AAoJEPTeZfMn+FaMeIQD/iNfsKYvRPWHEDcSHL8Cp5Gsf8fshrl4yA7md0SFq627
BtW+wYSBoUE1yuMQhQ64mzMOawvw9kZlYYZuMNmzaY9wtlSe8JpNm0OW10vp7bv3
FNaxBfJa2d+G8wkMPthAbSISd25P6LN1E3szD1IXpnTpY3GMfy1Ed8PFDD5IX26n
k1oD/RBBJp4qH81YpH4PrbBDtliH4xvSHZB/VxAf0AyUmCPj6Mk7SeOFpPayvpMs
ygwBuLvy1JANBI3DLckdmI1tSeOScBpjWqmtWB92U7G3s6bOtyDioDsjBrKzrx8G
RYE/ktdjGkfHqR4TSu7/51yofDGLY1ZHXUp9Kk3PbKWH4Uw5
=8AAO
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Revoked subkey:
:public key packet:
  version 4, algo 1, created 1402245840, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:user ID packet: "revoked <revoked@revoked.net>"
:signature packet: algo 1, keyid 1875FF0B267CDC0E
  version 4, created 1402245840, md5len 0, sigclass 0x13
  digest algo 2, begin of digest c0 34
  hashed subpkt 2 len 4 (sig created 2014-06-08)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID 1875FF0B267CDC0E)
  data: [2047 bits]
:public sub key packet:
  version 4, algo 1, created 1402245840, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid 1875FF0B267CDC0E
  version 4, created 1402245876, md5len 0, sigclass 0x28
  digest algo 2, begin of digest b6 9d
  hashed subpkt 2 len 4 (sig created 2014-06-08)
  hashed subpkt 29 len 14 (revocation reason 0x02 (revoke subkey))
  subpkt 16 len 8 (issuer key ID 1875FF0B267CDC0E)
  data: [2047 bits]
:signature packet: algo 1, keyid 1875FF0B267CDC0E
  version 4, created 1402245840, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 1d 4e
  hashed subpkt 2 len 4 (sig created 2014-06-08)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID 1875FF0B267CDC0E)
  data: [2048 bits]
-->
<textarea id="RevokedSubKey">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mQENBFOUktABCADNIFjmQ0/u6i2jAtgr0nI/sog7bCXouPSiXvCP2nej7wV7cyJ/
T13GaiWfKMYwLnOKcW9IifOD6qOOOzUThJ5DStq+n2Rs3uSgKiz1GpM6yGJvRSPt
sS3Ww+SOiz383htOZkCNP2LuCHx1e5Dr/m4AP0kDb7ZI5S8Q0aEN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ugc3Via2V5AAoJEBh1/wsmfNwOtp0H/1cRZujhum6Nbeg7Z36zQylpe0+L1fMF
5/bOtCD+BI9eVGv4134xUA33bYSZrnXQ7KOTJ3QoRwwiF4aOvLAPpsbUQmVo4yGk
bKDuxQdtIl6WK/f/Byd8JaNQffKx6mD5EGVglMIF0w9HMaP1w9Gyu3hRlbwVlFl/
BvyDdGNklm3Zv2v9gZ00W8ZXS1CvDwjl5jRlFxS9ID5x9WtxRF0n93fbCPslQh1s
rpPZJuNpXLKLS1aZhgYvBzHOALMkt9bcdm3pH0lxc8hLhbNQhhEThjvZSbhjCSUl
zzWGE+ZGB04+8M767UzCXXJKC+CRxnWYo2UVKPdWDOjVTA8xXyvI/oSJAR8EGAEC
AAkFAlOUktACGwwACgkQGHX/CyZ83A4dTggAvb8bWddqsuClTNj1uGKo9ilbzPh5
KGNfhtXPh+esCwzDq+2f2n3gWFQK98a5U6PVEINajTrrDcVBwtZbzy0eOwNh4SNv
tPHMi7LW3lWp+c3UziH/9rzKZC9foghoy6StVpt7ceffOUXMt4Ob1P0+Ei/B42xe
VbjYFJxk9Uhl17tfTMSJFTnwB4pouBtUa2+7hRyx9/Tdc04fJDJHzhwz1lZWLg/+
7bICPFJCiiR92WC/Rject5pZt83w3NGmFumYjj2GGujkUdqOnl/gFrRgBwHWo0Ap
1suv4gWhM6uEt/ufhMqmvDwvCOZJrJPa20zg+gErSjPJvARZhZ4OkXhi+w==
=80Vy
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Revoked main key:
// Key generation instruction:
// gpg --gen-key (RSA/RSA/1024 - uid=revoked-main)
// gpg --edit revoked-main
// gpg> revkey, key has been compromised, save, quit
:public key packet:
  version 4, algo 1, created 1408442396, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid 44416104FBFEA899
  version 4, created 1408442501, md5len 0, sigclass 0x20
  digest algo 2, begin of digest 19 4c
  hashed subpkt 2 len 4 (sig created 2014-08-19)
  hashed subpkt 29 len 25 (revocation reason 0x02 (Main key revocation test))
  subpkt 16 len 8 (issuer key ID 44416104FBFEA899)
  data: [1024 bits]
:user ID packet: "revoked-main <revoked-main@example.com>"
:signature packet: algo 1, keyid 44416104FBFEA899
  version 4, created 1408442396, md5len 0, sigclass 0x13
  digest algo 2, begin of digest c2 1a
  hashed subpkt 2 len 4 (sig created 2014-08-19)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 2 (pref-zip-algos: 2 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID 44416104FBFEA899)
  data: [1022 bits]
:public sub key packet:
  version 4, algo 1, created 1408442396, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid 44416104FBFEA899
  version 4, created 1408442396, md5len 0, sigclass 0x18
  digest algo 2, begin of digest b4 39
  hashed subpkt 2 len 4 (sig created 2014-08-19)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID 44416104FBFEA899)
  data: [1022 bits]
-->
<textarea id="RevokedMainKey">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mI0EU/MgHAEEALgGq+UDj7R5XwEl3wDzx4M2K3oBJI6ISuc7nJTCbNrcZ2yahAdF
i9Qmunoa8/rryHQZovuBX4QjkZsxorVzFmH+qvaczUYYMsN6vXGKAsPn0OX6AjRs
VesFtqZyi3yW9pLZaCRuikWeUumgJdbFBFS6uoGGwDKK0X1sqajFGIrlABEBAAGI
twQgAQIAIQUCU/MghRodAk1haW4ga2V5IHJldm9jYXRpb24gdGVzdAAKCRBEQWEE
+/6omRlMBACHerNXj6TFIf/h9yjVnL2PmvoMuAVMftVOnXJQq3ikW44Hu9iY+YwX
M6cevKXETAGuEhvKmBAneNUoC0oaQvel5G7VHQTJqlhVRzpv1M/Rqj3879VbGsSh
gmthv8y2lcPRcXvsB0FY/Jxi4v26CcvreYa77efvywuLD+fTaVOY6bQncmV2b2tl
ZC1tYWluIDxyZXZva2VkLW1haW5AZXhhbXBsZS5jb20+iLcEEwECACEFAlPzIBwC
GwMGCwkIBwMCBhUIAgkKCwMWAgECHgECF4AACgkQREFhBPv+qJnCGgP+LvSRVdS4
K+8Ps/LVplD8DP5jDOnMQIHanr85g8RD76gCXD7vqTCaQZbrwRwR43C1g+CB47vJ
l7jToVhjhdGKHKiRxoyF/xwhTDM9LtWA1PwneecoMYTTR4f8dvd+gX/BAOfwahlP
R/CoC8sUflBWb3nezl7mRXpKhVnLxo5DJKC4jQRT8yAcAQQA6xCjxRKKSPxp2lMl
Bd3a+qPtrW32THL7H0dpq+FJ0UiuP78Z6nQ1DWdMFIgQx4SBoBpnTlYNjiG4+XIk
e1WOVvLMpgBTjPHk/BCrweZhHbV/BF97sLxHcqDU40Uf/UUFweEUbVHAD5XrQasz
JmP9EAUUSEDUh/hh5tnPf/avw1sAEQEAAYifBBgBAgAJBQJT8yAcAhsMAAoJEERB
YQT7/qiZtDkD/jCMvfGLZDbw4pjPT/iHTynmltD57X946rqAkOp0mKdyxKS6CbIZ
nR2/cVSIeQoSBWU+qTj52Uw5bWj3uOVvJNfcAPOt7oyYdUJR0WojD7HXYJH9ym0G
/fgSVhEjpq3TDFQQ/s41bw6Nqbnqn+UAdOi97x9ow+zHd2OtVbnCICRE
=VB3i
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
ECC key to check subkey/user id signature verification.
:public key packet:
  version 4, algo 19, created 1377714336, expires 0
  pkey[0]: [72 bits] nistp256 (1.2.840.10045.3.1.7)
  pkey[1]: [515 bits]
  keyid: EAEB8A76AFE8C867
:user ID packet: "ecc real name <ecc@example.com>"
:signature packet: algo 19, keyid EAEB8A76AFE8C867
  version 4, created 1377714336, md5len 0, sigclass 0x13
  digest algo 8, begin of digest c6 d7
  hashed subpkt 2 len 4 (sig created 2013-08-28)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID EAEB8A76AFE8C867)
  data: [254 bits]
  data: [254 bits]
:public sub key packet:
  version 4, algo 18, created 1377714336, expires 0
  pkey[0]: [72 bits] nistp256 (1.2.840.10045.3.1.7)
  pkey[1]: [515 bits]
  pkey[2]: [32 bits]
  keyid: DBA95B52C1FBBA97
:signature packet: algo 19, keyid EAEB8A76AFE8C867
  version 4, created 1377714336, md5len 0, sigclass 0x18
  digest algo 8, begin of digest 3a 90
  hashed subpkt 2 len 4 (sig created 2013-08-28)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID EAEB8A76AFE8C867)
  data: [256 bits]
  data: [253 bits]
-->
<textarea id="EccKey">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.1.0-ecc (GNU/Linux)

mFIEUh5AoBMIKoZIzj0DAQcCAwT68182duSEJFXKa+qkBa0Vgeswnv8GP8tKYiU/
MCZd6dGTvrtf2gSjyAsVkB0V0idW7i8yW1wfh3y2AbGWDr/dtB9lY2MgcmVhbCBu
YW1lIDxlY2NAZXhhbXBsZS5jb20+iHoEExMIACIFAlIeQKACGwMGCwkIBwMCBhUI
AgkKCwQWAgMBAh4BAheAAAoJEOrrinav6MhnxtcA/iAteDFo/P5SU5XV/8/4BN9x
f28SuvwFipnjjyOmvB0eAP4kPM5LAp2EW+QIyG6+CJP1No9uWyZTdLPkTRgLtYhi
GLhWBFIeQKASCCqGSM49AwEHAgMEgk1dVpgPCM38NBNoBcvehm7mt6aUmK8mDb/M
SHo2/NlwfTh+BDCoVX5asSetzuW2RbnP6sCBwfsuLSrSWUVauwMBCAeIYQQYEwgA
CQUCUh5AoAIbDAAKCRDq64p2r+jIZzqQAQCcv0VOQFiNOM6JNdLHTqlCYxeoz09d
UP3LdgcnLED/YwD9FqcNrkok9BuXJ9+rXTSu+uqdWB7gpMO9mfk65d5IQ+s=
=xRCj
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Revoked one of two user IDs. Both user IDs are additionally signed by a
foreign key.

:public key packet:
  version 4, algo 19, created 1408970397, expires 0
  pkey[0]: [72 bits] nistp256 (1.2.840.10045.3.1.7)
  pkey[1]: [515 bits]
  keyid: E3CE624C647B3A23
:user ID packet: "revoked-userid <revoked-userid@example.com>"
:signature packet: algo 19, keyid E3CE624C647B3A23
  version 4, created 1408970568, md5len 0, sigclass 0x30
  digest algo 8, begin of digest 1c f0
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 29 len 27 (revocation reason 0x20 (Revocation because why not))
  subpkt 16 len 8 (issuer key ID E3CE624C647B3A23)
  data: [256 bits]
  data: [255 bits]
:signature packet: algo 19, keyid E3CE624C647B3A23
  version 4, created 1408970397, md5len 0, sigclass 0x13
  digest algo 8, begin of digest 77 ed
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 2 (pref-zip-algos: 2 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID E3CE624C647B3A23)
  data: [255 bits]
  data: [256 bits]
:signature packet: algo 1, keyid 6A69A7100F8C5C47
  version 4, created 1408970499, md5len 0, sigclass 0x10
  digest algo 2, begin of digest 83 58
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  subpkt 16 len 8 (issuer key ID 6A69A7100F8C5C47)
  data: [1023 bits]
:user ID packet: "non-revoked-uid <non-revoked-uid@example.com>"
:signature packet: algo 19, keyid E3CE624C647B3A23
  version 4, created 1408970478, md5len 0, sigclass 0x13
  digest algo 8, begin of digest b9 c1
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 2 (pref-zip-algos: 2 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID E3CE624C647B3A23)
  data: [256 bits]
  data: [256 bits]
:signature packet: algo 1, keyid 6A69A7100F8C5C47
  version 4, created 1408970530, md5len 0, sigclass 0x10
  digest algo 2, begin of digest c8 26
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  subpkt 16 len 8 (issuer key ID 6A69A7100F8C5C47)
  data: [1024 bits]
:public sub key packet:
  version 4, algo 18, created 1408970397, expires 0
  pkey[0]: [72 bits] nistp256 (1.2.840.10045.3.1.7)
  pkey[1]: [515 bits]
  pkey[2]: [32 bits]
  keyid: 4A5DD549DCAB5055
:signature packet: algo 19, keyid E3CE624C647B3A23
  version 4, created 1408970397, md5len 0, sigclass 0x18
  digest algo 8, begin of digest c3 f7
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID E3CE624C647B3A23)
  data: [256 bits]
  data: [256 bits]
-->
<textarea id="RevokedUserId">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mFIEU/sunRMIKoZIzj0DAQcCAwSRgY4eg7fVp2ILsmsFI4oZ2eXsqgemV7kNGuWa
tA+gmCXTxoLc2IK6PVM+93u4AJObM7Cm/6vJHW95Ohs8cqXWtCtyZXZva2VkLXVz
ZXJpZCA8cmV2b2tlZC11c2VyaWRAZXhhbXBsZ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I4WNTFC/
fsIfZQL9Ud/7uQQtoENfEG/lNW8wSP9AFfsiQDNIB+V08MoDAQgHiGEEGBMIAAkF
AlP7Lp0CGwwACgkQ485iTGR7OiPD9wEAirEelh1tRYGxy1Ghu9NBxLwXhY4BWtNd
NPC1SyXUmj0BAMi7TSyZFM1ETkAJJ1fnRREC1jBFHBBCg2J8Iwt0DCA7
=8vBI
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Key with user attribute packet
:public key packet:
  version 4, algo 19, created 1408973778, expires 0
  pkey[0]: [72 bits] nistp256 (1.2.840.10045.3.1.7)
  pkey[1]: [515 bits]
  keyid: D66B9F52D48A1C09
:user ID packet: "user-attr <user-attr@example.com>"
:signature packet: algo 19, keyid D66B9F52D48A1C09
  version 4, created 1408973778, md5len 0, sigclass 0x13
  digest algo 8, begin of digest a2 75
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 2 (pref-zip-algos: 2 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID D66B9F52D48A1C09)
  data: [256 bits]
  data: [253 bits]
:attribute packet: [jpeg image of size 6078]
:signature packet: algo 19, keyid D66B9F52D48A1C09
  version 4, created 1408973923, md5len 0, sigclass 0x13
  digest algo 8, begin of digest cc 0d
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 2 (pref-zip-algos: 2 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID D66B9F52D48A1C09)
  data: [256 bits]
  data: [256 bits]
:public sub key packet:
  version 4, algo 18, created 1408973778, expires 0
  pkey[0]: [72 bits] nistp256 (1.2.840.10045.3.1.7)
  pkey[1]: [515 bits]
  pkey[2]: [32 bits]
  keyid: F253FF905C7BE669
:signature packet: algo 19, keyid D66B9F52D48A1C09
  version 4, created 1408973778, md5len 0, sigclass 0x18
  digest algo 8, begin of digest 7e 50
  hashed subpkt 2 len 4 (sig created 2014-08-25)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID D66B9F52D48A1C09)
  data: [256 bits]
  data: [256 bits]
-->
<textarea id="UserAttr">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mFIEU/s70hMIKoZIzj0DAQcCAwRlbqzCg3a6Fmw+Uc9RLYq6W8DjF5K7sm1acR2c
dIg+Y1je9YqgBu5bsTGjMYs+zz2qI9U2l5XAP3rK+w6WsZ6GtCF1c2VyLWF0dHIg
PHVzZXItYXR0ckBleGFtcGxlLmNvbT6IeQQTEwgAIQUCU/s70gIbAwYLCQgHAwIG
FQgCCQoLAxYCAQIeAQIXgAAKCRDWa59S1IocCaJ1AQDPyRUKI5faHbt4anAUQY2Z
aHG1AUMR+rHKtGLFKBtlHgD9GzLvCt4R/IDZJplROykeo1188DSd0MZp8WQM1cqF
GWfR1xHXDwEQAAEBAAAAAAAAAAAAAAAA/9j/4AAQSkZJRgABAQAAAQABAAD/2wCE
AAkGBhIQEBIQDxMQEBAQFRERDxARFhUQFRgUFREXFBQUFRIYHCYfFxsjGRYSHy8g
IycpLCwsFR8xNTAqNSYuLCkBCQoKDgwOGg8PGiskHyQpKi4qKikvKyksLCw0LSwv
KSwqKSwpLCwsKSwsKSwpKSwpLCwsKSkpLCkpLCwsLCwsLP/AABEIAMgA+wMBIgAC
EQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAABQYDBAcBAgj/xABKEAABAwIBBQkN
BQUIAwAAAAABAAIDBBESBQYTITEHFRci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CLyiSVeclhhERTkAR
EQGOZmJrgNpBA9IUXvS/nb2n5KYRRVKManGRLCrKGxD70v529p+SkqSEsYGm1xfZ
1krMixToxpvKMzrSmsMwVkJewtFr6tqjt6X87e0/JTCJOjGbyxCtKCwiIbkl9xrb
2n5KXRFtTpRp9U1nUlPcIiKQjPCFMZyZzS174nzNjaYYmQN0Yc0YWkkE4nHXxj8l
EIsYWcmcvGAiIsmAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgC
IiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiI
gCIiA//ZiHkEExMIACEFAlP7PGMCGwMGCwkIBwMCBhUIAgkKCwMWAgECHgECF4AA
CgkQ1mufUtSKHAnMDQEA34xhJ3Vz7ojwaNNCT452bAx7MpdEfHlfSUYbnVd0NREB
AKT7wkSFYcBkhZBEh01CWyvtIlT9YsEdlmOnoOeSgf+yuFYEU/s70hIIKoZIzj0D
AQcCAwQ0k6t+GWddhqjY+J40mW5h3ehYxntduUhgSiRcaCDxHmAv4WvoIBYXyLtA
e5MjrboHifaLgwM74Em6PMl0k9LfAwEIB4hhBBgTCAAJBQJT+zvSAhsMAAoJENZr
n1LUihwJflABANNtk1A/8KdIydrXdwt5d8QekME4a77TTsIERw4z3hrVAQDm8tPb
GUlOSbBIO0YLTF2/1JxqHAlyk0E+WuNVyii53Q==
=lcS+
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
RSA keys. Only the 2nd subkey should be used for encryption, as noted in the
flags.

pub  1024R/5DDBA594  created: 2014-09-03  expires: never       usage: SCE
                     trust: ultimate      validity: ultimate
sub  1024R/8D9632F1  created: 2014-09-03  expires: never       usage: A
sub  1024R/B6307BCA  created: 2014-09-03  expires: never       usage: E
[ultimate] (1). different-encryption-subkey
    <different-encryption-subkey@example.com>

:public key packet:
  version 4, algo 1, created 1409749099, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:user ID packet: "different-encryption-subkey <different-encryption-subkey@example.com>"
:signature packet: algo 1, keyid D423EB9C5DDBA594
  version 4, created 1409749099, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 73 c6
  hashed subpkt 2 len 4 (sig created 2014-09-03)
  hashed subpkt 27 len 1 (key flags: 0F)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID D423EB9C5DDBA594)
  data: [1023 bits]
:public sub key packet:
  version 4, algo 1, created 1409749141, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid D423EB9C5DDBA594
  version 4, created 1409749141, md5len 0, sigclass 0x18
  digest algo 2, begin of digest b1 8e
  hashed subpkt 2 len 4 (sig created 2014-09-03)
  hashed subpkt 27 len 1 (key flags: 20)
  subpkt 16 len 8 (issuer key ID D423EB9C5DDBA594)
  data: [1024 bits]
:public sub key packet:
  version 4, algo 1, created 1409749184, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid D423EB9C5DDBA594
  version 4, created 1409749184, md5len 0, sigclass 0x18
  digest algo 2, begin of digest a0 b4
  hashed subpkt 2 len 4 (sig created 2014-09-03)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID D423EB9C5DDBA594)
-->
<textarea id="GnuPgKeyUsageFlags">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)

mI0EVAcQawEEAN3GlVqNbwKGrM3TjUfunatWqY5dzdBPyHMSQAt7tFbH3Mm8AZg7
egdWduEYSBD9GRt89QGDhfjLhPa2YUqemnLXVsqnEYrtthmwidzNOVvb25ItYZSZ
F0EYPk4TCPN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JAKEyi5IBqJ9thZz7JOE0cJtqcjhzA
SFg0U0bwROqmKl3upwok+mrlw5SuTJOMNNGACrFoco/z5Q53t4TgvqD4rF/PPCM5
j/GbY0dnReClicttomuqZKLB3ANeap1s8cmJSinmtL+0lwNUzW/swRX3rw/Fo1Mn
=x53K
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
  The primary key can neither sign nor encrypt. It has a single
  signing subkey. It should return a null if a public encryption
  subkey is requested.

:public key packet:
  version 4, algo 1, created 1418654084, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
  keyid: 8A20F7D9D02291A5
:user ID packet: "gpg-test <gpg-s2k@test.com>"
:signature packet: algo 1, keyid 8A20F7D9D02291A5
  version 4, created 1418654084, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 65 21
  hashed subpkt 2 len 4 (sig created 2014-12-15)
  hashed subpkt 27 len 1 (key flags: 01)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID 8A20F7D9D02291A5)
  data: [1024 bits]
:public sub key packet:
  version 4, algo 1, created 1418654101, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
  keyid: 87EBC27D4CA8E30D
:signature packet: algo 1, keyid 8A20F7D9D02291A5
  version 4, created 1418654101, md5len 0, sigclass 0x18
  digest algo 2, begin of digest c1 e5
  hashed subpkt 2 len 4 (sig created 2014-12-15)
  hashed subpkt 27 len 1 (key flags: 02)
  subpkt 16 len 8 (issuer key ID 8A20F7D9D02291A5)
  subpkt 32 len 156 (signature: v4, class 0x19, algo 1, digest algo 2)
  data: [1022 bits]
-->

<textarea id="SignOnlyPublicKey">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mI0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4qWk8+7uX42u7LRuEE1xB9yeOG4X
d8SAPYc=
=fFTC
-----END PGP PUBLIC KEY BLOCK-----
</textarea>

<!--
Only secret signing and encryption subkeys are available. This is a
somewhat used configuration for gnupg; where the certification
(primary) secret key is stored elsewhere, and only secret subkeys are
generated/used inside multiple devices/implementations.

Ensure we can import, and return the correct subkeys when requested.

:secret key packet:
  version 4, algo 1, created 1418865844, expires 0
  skey[0]: [1024 bits]
  skey[1]: [17 bits]
  gnu-dummy S2K, algo: 3, SHA1 protection, hash: 2
  protect IV:
  keyid: 354F6BFEC9789F00
:user ID packet: "subkey-only <sub@key.only>"
:signature packet: algo 1, keyid 354F6BFEC9789F00
  version 4, created 1418865844, md5len 0, sigclass 0x13
  digest algo 2, begin of digest f6 6f
  hashed subpkt 2 len 4 (sig created 2014-12-18)
  hashed subpkt 27 len 1 (key flags: 01)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID 354F6BFEC9789F00)
  data: [1024 bits]
:secret sub key packet:
  version 4, algo 1, created 1418866003, expires 0
  skey[0]: [1024 bits]
  skey[1]: [17 bits]
  iter+salt S2K, algo: 3, SHA1 protection, hash: 2, salt: 3b305916d790802e
  protect count: 65536 (96)
  protect IV:  9a dd 5b 63 af 00 78 1a
  encrypted stuff follows
  keyid: A544CE2DFDAF0B58
:signature packet: algo 1, keyid 354F6BFEC9789F00
  version 4, created 1418866003, md5len 0, sigclass 0x18
  digest algo 2, begin of digest bf 02
  hashed subpkt 2 len 4 (sig created 2014-12-18)
  hashed subpkt 27 len 1 (key flags: 02)
  subpkt 16 len 8 (issuer key ID 354F6BFEC9789F00)
  subpkt 32 len 156 (signature: v4, class 0x19, algo 1, digest algo 2)
  data: [1021 bits]
:secret sub key packet:
  version 4, algo 1, created 1418867855, expires 0
  skey[0]: [1024 bits]
  skey[1]: [17 bits]
  iter+salt S2K, algo: 3, SHA1 protection, hash: 2, salt: 1f6ce8fc83014f2c
  protect count: 65536 (96)
  protect IV:  85 38 a8 6e a7 f6 5a 06
  encrypted stuff follows
  keyid: 1389A78D4206E4CD
:signature packet: algo 1, keyid 354F6BFEC9789F00
  version 4, created 1418867855, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 1a d0
  hashed subpkt 2 len 4 (sig created 2014-12-18)
  hashed subpkt 27 len 1 (key flags: 0C)
  subpkt 16 len 8 (issuer key ID 354F6BFEC9789F00)
  data: [1024 bits]
-->
<textarea id="SubkeyOnlySecretKey">
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v1

lQCVBFSSLLQBBACsN7uPFglHxv24ySUp52I95QhmuMouC5TP3nWhTjlT6/T3OOuP
K2Ejp6fknYN6Dw8k6R8LihQHY3uHy78nJtdtjWF8t+QBrQnKm2KTQbERfZaEWB9T
5tA3kNyCIZ0qYRjwUQclL7Ru9pEtNOYOr62b+/v0HjvMPLoouuVxogzC5wARAQAB
/gNlAkdOVQG0GnN1YmtleS1vbmx5IDxzdWJAa2V5Lm9ubHk+iLgEEwECACIFAlSS
LLQCGwEGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEDVPa/7JeJ8A9m8EAIoq
qRKRp5ANqRTkX0wvCRsz7vwMjIB5FOOB/AisvXKcuKhz5dvTy0zB9eZM2s+PO+og
+EVWDBb+OpWg84zMEcnbw/WvZ3RXRjThFZp7JYnUY9MRwvUj/yxJroKVTDl/TXlD
QKD87IB8cNGuBDr88Mh7NpzMOPF8mM6Y2T2huvwanQH+BFSSLVMBBAC+7TnrYNzO
3+I8VH8T+Zn2dKxl081Rhre1kEM0Xv/6znTelwly3VqQZLE+bYH2RsmL0tcN94c9
oa470XudGToIs5WeNLqWUL5wR5oF+LR/jvPl6nLSJPPVsBmS8WxNsNEaF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DbZHkMfHDE8QX8tbOiDISkhDgL9hKd8h5cPIWL2lW/+5o/a
3ZB86MqHBEz0zhqgZW/+VFOGnndaloiRnneERQTPXquYJB9AWeHToB1XABEBAAH+
AwMCH2zo/IMBTyxghTiobqf2WgZTGaG582Cm7zeslEtuLXi95xM9ApvQscAT2hFf
22qe5NCdRB0K1+PugNsh6h8Jj9wTy5FVfQfR3aU0hRMe0ts49dj8+Trd02WkFivn
Xm0I3KZOg/GrsrpFox6TTvFC2ARMfq8FOEyAf18XOR7PFgnEV8xfGC4wMOyYC7Bo
wEEShZHM5M9SGBhbmCIQ/FIHi1KwvU333t6N/Us4I1FKJDgK7tL2zfrlT4TWHhPZ
UDA9gWplY2I5yydhNAUo9hhMVOFTZYNXRCepr2Lftz3+2jq8vHoPLVCO1uTduO9J
XfWINzLt9vBB4vlh5OzyRr4BKbgST32pf4tNrhUOgJesS6L0YSlhYvfLz4pfuMVe
7PWD/dTeVfQitE6RiGsCBPUqFBVVy4M5+iMtWGAjay6SgTEvdJHi4izLMB+mZYet
JvtoYSa6ojl1LVNghFYYphAoKvQt4I1N4KyAhJ8I22CInwQYAQIACQUCVJI0jwIb
DAAKCRA1T2v+yXifABrQBACPmVwj6CwoNxb9WwHk8G5QMN+2dqIYq6jGFiAHMGPM
Df16XtxceTVl0RFprIuAt7fSCs2YiIwZvXlrcMRoqyuSNsIrkL+xWLTo5bIFfj+L
Dik7VlNsvLdjwAOWuT2FlZ5NOXas3UKtlr4Rruw1ZSXbT5qcRDFbGU3D7o0YP/fb
/Q==
=iqk+
-----END PGP PRIVATE KEY BLOCK-----
</textarea>

<!--
Secret key DSA/DSA with no explicit keyflags set - the subkey
should be selected for signing operations.

:secret key packet:
  version 4, algo 17, created 1410274798, expires 0
  skey[0]: [1024 bits]
  skey[1]: [160 bits]
  skey[2]: [1023 bits]
  skey[3]: [1023 bits]
  iter+salt S2K, algo: 7, SHA1 protection, hash: 8, salt: 0e5250d32bd85b90
  protect count: 65536 (96)
  protect IV:  1b ac 10 8d 0d 66 72 ee 61 c1 a6 22 0b 7f 75 91
  encrypted stuff follows
  keyid: B471D19456481C9A
:user ID packet: "default-key-usage"
:signature packet: algo 17, keyid B471D19456481C9A
  version 4, created 1418914798, md5len 0, sigclass 0x13
  digest algo 2, begin of digest d6 4d
  hashed subpkt 2 len 4 (sig created 2014-12-18)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  subpkt 16 len 8 (issuer key ID B471D19456481C9A)
  data: [160 bits]
  data: [159 bits]
:secret sub key packet:
  version 4, algo 17, created 1410274798, expires 0
  skey[0]: [1024 bits]
  skey[1]: [160 bits]
  skey[2]: [1023 bits]
  skey[3]: [1021 bits]
  iter+salt S2K, algo: 7, SHA1 protection, hash: 8, salt: 0e5250d32bd85b90
  protect count: 65536 (96)
  protect IV:  57 92 12 db d4 64 38 03 b8 e2 55 00 0f 44 b9 3d
  encrypted stuff follows
  keyid: 2AD936C0DDB2552A
:signature packet: algo 17, keyid B471D19456481C9A
  version 4, created 1410274798, md5len 0, sigclass 0x18
  digest algo 2, begin of digest f0 62
  hashed subpkt 2 len 4 (sig created 2014-09-09)
  subpkt 16 len 8 (issuer key ID B471D19456481C9A)
  data: [159 bits]
  data: [160 bits]
-->
<textarea id="DSADSADefaultKeyUsage">
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v1

lQHpBFQPFe4RBACOY5b4/FYCkuvu5rV2lbqTGUkzNH5OFFMnugh99sfVR2jIv3mf
q1dluTqy5S8CVj2q6qJgNCKpZ+Bnzsrx7jmFnGmkSjw6VtjN8f3U0D4r+suzI2CZ
R8t7b/Jc+qCXLrD4SjwBAtGBvs3oXfnrngf+kp18T5QRWvt0ay0EE75PqwCg5+PO
oL2tnxjj9NVQbGr8m9+sl7UD/2WFP/KM8KS4ezu7HQUDA7x8sYfD2DaSfPuxbFE8
Kvqa2xRX0Sa6kF+RfiWV/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
7zjDV1L+BwMIDlJQ0yvYW5BgV5IS29RkOAO44lUAD0S5PZIW7x8Grvoph6goKbD1
+yCaUEhzcuedD8JLyfedlALDs1cKg0RqWBNCx4hGBBgRAgAGBQJUDxXuAAoJELRx
0ZRWSBya8GIAn1czWNBsYw3zwAa4l5DF+yRPzgKkAKDQpnBen+0rk+S/N1CusDNB
CgAJ0w==
=FN/h
-----END PGP PRIVATE KEY BLOCK-----
</textarea>

<!--
 RSA-s/RSA-e key but with no explicit key-usage flags. The
 appropriate key should be picked up for encryption/signing.

:public key packet:
  version 4, algo 3, created 1410288017, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
  keyid: 04C78703EFBF9416
:user ID packet: "rsa-rsa-default"
:signature packet: algo 3, keyid 04C78703EFBF9416
  version 4, created 1418928017, md5len 0, sigclass 0x13
  digest algo 2, begin of digest a7 ca
  hashed subpkt 2 len 4 (sig created 2014-12-18)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  subpkt 16 len 8 (issuer key ID 04C78703EFBF9416)
  data: [1022 bits]
:public sub key packet:
  version 4, algo 2, created 1410288017, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
  keyid: D768A4153A7326C3
:signature packet: algo 3, keyid 04C78703EFBF9416
  version 4, created 1410288017, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 21 4a
  hashed subpkt 2 len 4 (sig created 2014-09-09)
  subpkt 16 len 8 (issuer key ID 04C78703EFBF9416)
  data: [1020 bits]

-->
<textarea id="RSARSADefaultKeyUsage">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mI0EVA9JkQMEAJr4nAio6oS1NjJousigaCEZQWPLzu7S2SH1873RklKJEcex5RXc
6IZUCeFh27vYpGiMVsHn389jnZYj4xdbG8qGsdEq5OT7+aW31Uk/Ro2nRPSs/E0T
rS2DOY/8INffAt+C87wF+S7cQbPEeGOKBTcmWGqqxX4rZsBPl3VxagxxABEBAAG0
D3JzYS1yc2EtZGVmYXVsdIilBBMDAgAPBQJUkx+RAgsHAhUIAh4BAAoJEATHhwPv
v5QWp8oD/jDlPbR4AgpEwLqYOI5dUO0gQoG2G+2JK2qCNuy8SMTMBfiPz1TW62Hn
mOFz1wWRgwNwIl4+F1qC4o8nxORIKyXJBngUhekSifWoWPyMzp2om7Ipta/dQjKU
wZV2fVStiqqK1u7l1t0pYLs3Giy8V0PAflDKkVIZqw9xCJegK6RauI0EVA9JkQIE
AJE6gdvcDLDc/O5b+Blh/8e/fARxcDBpSJsOE86n7N2Prve3Fa17sBT2T1pPDOiB
3YmQv6pHC1afFHb5qnsFY/5aS3mp+zsmNW0L2oD4vSY0QRnKIzBh33QZv2Di5kKf
FNIOGgMovmsyXISZYeAwsnLDSSTbsgHjGR8fqdyf7BaHABEBAAGInAQYAwIABgUC
VA9JkQAKCRAEx4cD77+UFiFKA/wOG2PxB1iDtDeLAUfOP0zMx6qBQfWCyWldKze/
bom5SwbLT42+Aks9B0RU6JKdd8WfwTlJyQeM56aUe1wPwVHBe+zTG+XvsYree3rQ
HFEgHTN3KEPHc6EcQqrhcYJ4IBFau0avBvi7QjsSOvePvIKFO/DuDIECRpLZjRW+
VKisag==
=fTBV
-----END PGP PUBLIC KEY BLOCK-----
</textarea>

<!--
UID with an expired certification signature.
:public key packet:
  version 4, algo 1, created 1400629566, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:user ID packet: "expired-key"
:signature packet: algo 1, keyid 0B448FF3EF40D052
  version 4, created 1400629566, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 11 65
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  critical hashed subpkt 2 len 4 (sig created 2014-05-20)
  critical hashed subpkt 3 len 4 (sig expires after 1d0h0m)
  subpkt 16 len 8 (issuer key ID 0B448FF3EF40D052)
  data: [2047 bits]
:user ID packet: "good-key"
:signature packet: algo 1, keyid 0B448FF3EF40D052
  version 4, created 1409270276, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 9d 08
  hashed subpkt 2 len 4 (sig created 2014-08-28)
  hashed subpkt 27 len 1 (key flags: 2F)
  hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
  hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
  hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
  hashed subpkt 30 len 1 (features: 01)
  hashed subpkt 23 len 1 (key server preferences: 80)
  subpkt 16 len 8 (issuer key ID 0B448FF3EF40D052)
  data: [2046 bits]
-->
<textarea id="ExpiredUid">
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBFN76T4BCACA04Pjpjl4i2+5tM/o5p3nFDuYga8ApFgBJHaQkYExYktGqi5j
a9q4DTDCt9j+wJorzBryJuDYA6y32WHY5TPFShBArSZC4rx/ObDFUBRgSP85cQDP
kcAXVmBHH1X3DtB5apgPtrehY3U8O3Ii/yQlTCfXxUVvpVZMYt+c+7+ZAPIsttlt
oHKDw1P8ZOHruU7lzMrmOaALdcyPphHzoF0jaxnmX5lpRua4TIqUz7CwiSBZdZr5
GP3lVL9x6z4MSVpdotkMxlK7ucyoISNDG1Bd/MUN7salkiFynMvkX8UC//KbIgqa
9WI66j9R3L007RAz+AyLuL3O0zsMqJguTH9FABEBAAG0C2V4cGlyZWQta2V5iQEu
BBMBAgAYAhsDAgsHAhUIAh4BBYJTe+k+BYMAAVGAAAoJEAtEj/PvQNBSEWUH/3E8
JmeWH4KzKDWOaufQCEaZR6pwTcINPOM4vzP098zmcaYy6KeavQe1KqfNo90JE2XX
l9VvwA3DKDDMZ1T1RdwOZtLs3ItnUEGMUaDHx2teQyRzUAtTEGRe4jKE5H0D2AH3
/ZWDSohKFp/qmZvTZ5/s27At9omj/Hys/2H4SoSZT8TJfo9qC5dtziSHroPqF3xx
d6irZf900+Psf6reIusENz6n030pvSiT18pmCP8JDcJlbcSiZN2ixHQkCiM8Jnrf
JFZ0/MqAxP1+dqN9U8XD1sKeq7iZWJjOTHOqMb+Tmek5/nQfzd22WRam5mzB5qnX
Fz5qykc9wJLpO3vsJrG0CGdvb2Qta2V5iQE4BBMBAgAiBQJT/8IEAhsvBgsJCAcD
AgYVCAIJCgsEFgIDAQIeAQIXgAAKCRALRI/z70DQUp0IB/4m1G60KnB1bF1xg6pv
8CPcDZMQKWHsKbAdA1bLJjNjfXQPBDXcDAS9yfyqKV5cy7Jkz4oOkeYTpy9iKqIn
Nq97JChuHFYuxfzs0EQAxK/0hpE2tNBNgTGM1QkNOVMiMwD3lXT+Y8efo0hgQ1wp
qzL1GLnjrRkaxIYd2Q4NYLcFJxe2vET5ZUilS/Gejd5IQtlnOoPdP9hewPagl9qh
UmrxEV9n1w+hDGiEbX9d+QIeSoZPWJkY6FptI0E2npIOB3LF3UQ83NdhHG+YbVja
5GazLV2afoD//WageNM2vQ0IlRKOHIf8JbJMX6Qhf33dq2tjNaziNBs4gjf79ZU4
aDYh
=gHUD
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Three signatures on a uid, with one revocation signature. However, the
latest signature is a certification, which should mark the key as
being certified for the provided userid.
:public key packet:
  version 4, algo 1, created 1412023581, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
  keyid: 57CC7CB355BA0491
:user ID packet: "should-not-expire"
:signature packet: algo 1, keyid 57CC7CB355BA0491
  version 4, created 1412023581, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 6f a0
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  critical hashed subpkt 2 len 4 (sig created 2014-09-29)
  subpkt 16 len 8 (issuer key ID 57CC7CB355BA0491)
  data: [1023 bits]
:signature packet: algo 1, keyid 57CC7CB355BA0491
  version 4, created 1419799581, md5len 0, sigclass 0x30
  digest algo 2, begin of digest 7b 8b
  critical hashed subpkt 2 len 4 (sig created 2014-12-28)
  subpkt 16 len 8 (issuer key ID 57CC7CB355BA0491)
  data: [1023 bits]
:signature packet: algo 1, keyid 57CC7CB355BA0491
  version 4, created 1420231581, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 2d fc
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  critical hashed subpkt 2 len 4 (sig created 2015-01-02)
  subpkt 16 len 8 (issuer key ID 57CC7CB355BA0491)
  data: [1023 bits]
-->
<textarea id="ValidUid">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mI0EVCnFHQEEAKDhazuhtDroMEiRVfLu2F/mAe/zgvtK+YuVyHWp2bDj+sYamlc+
2ZentqbE0D7YHxw5lhbX+U/Qv2k1zDxakKKs+Dr8gbsYFI4ha/kXuztQTta+50Pc
5C8zmsx73mIJ/VO/NT+a3wkr/N0OeHcDd1ZPA5rDup57TlmkjlZzm/3rABEBAAG0
EXNob3VsZC1ub3QtZXhwaXJliKgEEwECABICGwMCCwcCFQgCHgEFglQpxR0ACgkQ
V8x8s1W6BJFvoAP/S29CS1hLzTFFN60RRZxMxcDevHOxIb5SsrfFAuyo4rEtHZi/
cf3OgNGOIe5vrTwUrIu91RT7Y/2GaC5cuotrutBjjSLb/ZfkUB7ZRbh5v/xOqZpl
aNVGtxVIPj6DJhObeSFrzDvrpIsyb973E+1rq5OEcMhPnhlILiv58sC5ozKInAQw
AQIABgWCVKBsHQAKCRBXzHyzVboEkXuLA/9eV5SD9SGCm1b/V9jQ8BA5f5K0XDnM
d99ZoYI8RbH94k092CDT3oAAWdEG4VTtr4FJDldMUCwDLfZZnGqbDHQSTmnzxIGV
g0PF8LaTcemN8hLmUFvyEl/Vt9kg8msQuYY4HLqa9UZK8vS1zQVb0N3pPwgZ8q8a
7tycbupcNFJFooioBBMBAgASAhsDAgsHAhUIAh4BBYJUpwOdAAoJEFfMfLNVugSR
LfwD/1XSqH1GfPRsGd1viG36/QyZ5bOoiqqQlCyaICEyC3+Qd8/uP7iLrFVAY9Rz
5DDBOZKzZlHt0Wv85sNdO13gH6cIsikmHalkuO7+F9GesM7MXzZxO0J0mKjLEe65
Ra3p0vRrD2DhwUd9gHm0KwJy7vEQAoh7b3nz789PZNcVbddz
=dGzQ
-----END PGP PUBLIC KEY BLOCK-----

</textarea>

<!--
Three signatures on a uid, with one recovation signature. However, the
latest signature is a revocation, which should remove the userid from
the key.
:public key packet:
  version 4, algo 1, created 1412024512, expires 0
  pkey[0]: [1024 bits]
  pkey[1]: [17 bits]
  keyid: 50F20BB38F54BB0B
:user ID packet: "should-revoke"
:signature packet: algo 1, keyid 50F20BB38F54BB0B
  version 4, created 1412024512, md5len 0, sigclass 0x13
  digest algo 2, begin of digest ef 9f
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  critical hashed subpkt 2 len 4 (sig created 2014-09-29)
  subpkt 16 len 8 (issuer key ID 50F20BB38F54BB0B)
  data: [1024 bits]
:signature packet: algo 1, keyid 50F20BB38F54BB0B
  version 4, created 1420232512, md5len 0, sigclass 0x30
  digest algo 2, begin of digest b2 84
  critical hashed subpkt 2 len 4 (sig created 2015-01-02)
  subpkt 16 len 8 (issuer key ID 50F20BB38F54BB0B)
  data: [1024 bits]
:signature packet: algo 1, keyid 50F20BB38F54BB0B
  version 4, created 1419800512, md5len 0, sigclass 0x13
  digest algo 2, begin of digest a0 0d
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  critical hashed subpkt 2 len 4 (sig created 2014-12-28)
  subpkt 16 len 8 (issuer key ID 50F20BB38F54BB0B)
  data: [1024 bits]
:user ID packet: "good"
:signature packet: algo 1, keyid 50F20BB38F54BB0B
  version 4, created 1420664512, md5len 0, sigclass 0x13
  digest algo 2, begin of digest cd 33
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  critical hashed subpkt 2 len 4 (sig created 2015-01-07)
  subpkt 16 len 8 (issuer key ID 50F20BB38F54BB0B)
  data: [1023 bits]
-->
<textarea id="RevokedUid">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
Comment: Use "gpg --dearmor" for unpacking

mI0EVCnIwAEEAMOAK0ih0zqegWYOKd5MnQaqiR7aFuvUOPmD8usq1eaL7o2LfzkI
sUDHVPuQWqgExvbV0BhB3pqpWc1POPIj9RqaBuVbDRh3/h9nXb4D+ZieAmLG0vrf
nGhTO4v78Wrr4b37ggJVoPQp2vRQH2alUjMvOmoM33Yr+22hIkzHIosbABEBAAG0
DXNob3VsZC1yZXZva2WIqAQTAQIAEgIbAwILBwIVCAIeAQWCVCnIwAAKCRBQ8guz
j1S7C++fBACYMFGYCyFkCL+oNP8MZsC4NqdHjb4jHVSKD1T7vpNs+J5nsJABcNz1
4U5LiVteQWK+ommchV9LdKNl40axhnXsfAixz7UTA2ArypHaPAP8xv/hAP0wXcn5
5jHxSk4M4rAUH2y+IU2+r8YZNvLCZNKO9kppfSuYDyw5pbs8bMv5BIicBDABAgAG
BYJUpwdAAAoJEFDyC7OPVLsLsoQEAIQlekZqSr/AGg7D9gIQx/l6xXGY7732slQa
cLPZr8Szht2hc31dOICB8erMo2HdsitXOYB5rNloY33FB48NQGOEU/e8ephpgzni
WSztbBX5SVrNgi5mrZlAX98KYhOMb1XvB3lacZZY7sqhmjjdM5m6hyPjYGoxDUyE
PGvnNOpXiKgEEwECABICGwMCCwcCFQgCHgEFglSgb8AACgkQUPILs49UuwugDQQA
lEpsMAtyHW/p2sxiFplHMtOsAsJ1rsRNTKUzGLNCQWNsRAgZwY7J+g2DcIiPxf17
8bpPlESkYIXgzeyABfJqzSsgQqXvyXCoG0XbZ9Y2az/F2BitLAdph3IDcGv2cPch
rm0+J/vPh6eS9Uh8EY6k+iJI0MkX7KbwvwWTGPiTpbO0BGdvb2SIqAQTAQIAEgIb
AwILBwIVCAIeAQWCVK2ewAAKCRBQ8guzj1S7C80zA/9XK4F390WiFWj3Atb8lRQB
fOowa+GGd61is0ohXZNk7E4p5US1ozqOIcrggVKs4k4NckTQnpylIPn5csWEeIJK
HE7RIOSyiEU+ksoJDoGuZqgo0V6C5lGeDqUg1u/bcQcwkE6f/QahD/C9uBGou5SY
VKxljMH6lfwqdGT6xNa5qQ==
=KIyw
-----END PGP PUBLIC KEY BLOCK-----
</textarea>

<!--
Subkey with an expired binding signature
:public key packet:
  version 4, algo 1, created 1400631183, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:user ID packet: "expired-subkey"
:signature packet: algo 1, keyid 6CCE47F4114F7C6B
  version 4, created 1409271184, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 59 9c
  hashed subpkt 2 len 4 (sig created 2014-08-29)
  hashed subpkt 27 len 1 (key flags: 03)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  subpkt 16 len 8 (issuer key ID 6CCE47F4114F7C6B)
  data: [2047 bits]
:public sub key packet:
  version 4, algo 1, created 1400631183, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid 6CCE47F4114F7C6B
  version 4, created 1400631183, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 64 b2
  hashed subpkt 27 len 1 (key flags: 0C)
  hashed subpkt 2 len 4 (sig created 2014-05-21)
  hashed subpkt 3 len 4 (sig expires after 1d0h0m)
  subpkt 16 len 8 (issuer key ID 6CCE47F4114F7C6B)
  data: [2046 bits]
-->
<textarea id="ExpiredSubkey">
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBFN7748BCADlXXWbsunER3lvTHEElkViIq25VGtakZoaLv3q97VYZ0kIW+qQ
06tSu3CzK+JN0tcYBoejry2f/k6mmIW8IB9OAtkTyOLLyC5cL4hyHe49hqFP5wzI
KPaRphO0qAI7WZyxvGjLkVF7mVSoj8Uu6nTSnEtCg3/axxv2Wtrq5aOD9EoikZMP
wZQpqLM0Tw7yCgckOgDHlTd8LV1Ay1bIYWjj3UmdwrTpAq/noKMMj2zXeiXWjUlv
6J664dICjYmv/NcEqzFpz3R9w7ndRhWZtqhLydc/8zI/IY8q/ebsTi+kZaSW5GIg
U5lcZXE/JpyeMPQKqWol5qpUmYWNJqLqAiklABEBAAG0DmV4cGlyZWQtc3Via2V5
iQEoBBMBAgASBQJT/8WQAhsDAgsHAhUIAh4BAAoJEGzOR/QRT3xrWZwH/2SjkXGc
EinBoVNivrsLGOdrUua/aTY6PDy1J4rIypdDkTtgywvt+KKwL6BjraHhRmVEGU26
oXdrKHXHnuP4MWFUHwsAdPkA6C0cPxeJxrORL/OQ5IPx17LLe2cwVVPBmM8NHbmz
pLuKAFU7Qf0N79RoOfqolfM1wdUDQMvB18YriVGpBLHfujzcnzMfsISFNquRcb+V
Uo5iLJ0Vk/JlkYSop+hGHFb+OWSXx0SC6yXuVSnC635457y+GHbhGy7Y50JCKO4J
UKQctDDZm6AIInBOhnTEGc6RbMSYQhvi7Z/6WJnvxf6abbVKIujHXJq+An2dGVIQ
R7Nlxif2N8MY+XW5AQ0EU3vvjwEIAMUUsMpyABuPhQm3Qu76bg1/P2Wqf8de/oo1
k0grjy177jaGAdViLosvHYdp46BVT/z4NDS1ZVHb2fcuC/0YzVuevHC5IA4fiSUr
QrjMJVB5eB8+Y2fc2matvrZyBmcicUHV/LCQ6de4QFHBKs3Qj9HBIFMLMUMsEVH5
g08uFCUpSgPV2MyB2eAZARZ4Z4O5bLWNpafELNdJ2JgTuHjYH5SkeF5kR5m0KMKw
BizcqxmtzMBipq8DNi8zgkwY2E7ngrtMFLUQSvTVNxQnWGlm/osL7GCXv+Vtuee1
eu/h6Jsf7FCObY9SQs7xxCVWnQC3PNbAfpbrk1bU4nMt9+DBDHUAEQEAAYkBJQQY
AQIADwIbDAUCU3vvjwUDAAFRgAAKCRBszkf0EU98a2SyB/42odA+rA8vw9xiQRQg
bJMW/lmeSBmHI5MmomgtRrYtizDPx//8FsWBi8oPF1sw2vBWZEkqEeVBhhLoqxEk
c2XcjQnOqrYDZ1Cn6W8v+IoKePQNaltJpgcJu/vyUXtf2b6rKVCsAOmJVGzsM+m3
g3iuMSXKi3dWTs0S7ezusfhSqtBZEouRvsnlVUM/ZHhWY8fFpz4UF7ARH9mS2Aqc
hx5JIGRQP5teVX0unJCgdLICk2CmqENqMeg7MyMu1/0KoW+FMgBuD9X9HsqLHD1s
l79KGLk9OEwlEPU9k0ejqC6zUDXp+F01zTTBtrkqI0fgOE9hsrc3IMZLmWLgUKvy
59L+
=9yM7
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Signing subkey that misses a cross-signature
:public key packet:
  version 4, algo 1, created 1394133622, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:user ID packet: "invalid-signing-subkeys"
:signature packet: algo 1, keyid EDD40D05081E923F
  version 4, created 1402773625, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 74 de
  hashed subpkt 2 len 4 (sig created 2014-06-14)
  hashed subpkt 27 len 1 (key flags: 01)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  subpkt 16 len 8 (issuer key ID EDD40D05081E923F)
  data: [2046 bits]
:public sub key packet:
  version 4, algo 1, created 1394133622, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid EDD40D05081E923F
  version 4, created 1402773625, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 4c c2
  hashed subpkt 2 len 4 (sig created 2014-06-14)
  hashed subpkt 27 len 1 (key flags: 02)
  subpkt 16 len 8 (issuer key ID EDD40D05081E923F)
  data: [2043 bits]
-->
<textarea id="MissingCrossSignature">
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBFMYynYBCACVOZ3/e8Bm2b9KH9QyIlHGo/i1bnkpqsgXj8tpJ2MIUOnXMMAY
ztW7kKFLCmgVdLIC0vSoLA4yhaLcMojznh/2CcUglZeb6Ao8Gtelr//Rd5DRfPpG
zqcfUo+m+eO1co2Orabw0tZDfGpg5p3AYl0hmxhUyYSc/xUq93xL1UJzBFgYXY54
QsM8dgeQgFseSk/YvdP5SMx1ev+eraUyiiUtWzWrWC1TdyRa5p4UZg6Rkoppf+WJ
QrW6BWrhAtqATHc8ozV7uJjeONjUEq24roRc/OFZdmQQGK6yrzKnnbA6MdHhqpdo
9kWDcXYb7pSE63Lc+OBa5X2GUVvXJLS/3nrtABEBAAG0F2ludmFsaWQtc2lnbmlu
Zy1zdWJrZXlziQEoBBMBAgASBQJTnKB5AhsBAgsHAhUIAh4BAAoJEO3UDQUIHpI/
dN4H/idX4FQ1LIZCnpHS/oxoWQWfpRgdKAEM0qCqjMgiipJeEwSQbqjTCynuh5/R
JlODDz85ABR06aoF4l5ebGLQWFCYifPnJZ/Yf5OYcMGtb7dIbqxWVFL9iLMO/oDL
ioI3dotjPui5e+2hI9pVH1UHB/bZ/GvMGo6Zg0XxLPolKQODMVjpjLAQ0YJ3spew
RAmOGre6tIvbDsMBnm8qREt7a07cBJ6XK7xjxYaZHQBiHVxyEWDa6gyANONx8duW
/fhQ/zDTnyVM/ik6VO0Ty9BhPpcEYLFwh5c1ilFari1ta3e6qKo6ZGa9YMk/REhu
yBHd9nTkI+0CiQUmbckUiVjDKKe5AQ0EUxjKdgEIAJcXQeP+NmuciE99YcJoffxv
2gVLU4ZXBNHEaP0mgaJ1+tmMD089vUQAcyGRvw8jfsNsVZQIOAuRxY94aHQhIRHR
bUzBN28ofo/AJJtfx62C15xt6fDKRV6HXYqAiygrHIpEoRLyiN69iScUsjIJeyFL
C8wa72e8pSL6dkHoaV1N9ZH/xmrJ+k0vsgkQaAh9CzYufncDxcwkoP+aOlGtX1gP
WwWoIbz0JwLEMPHBWvDDXQcQPQTYQyj+LGC9U6f9VZHN25E94subM1MjuT9OhN9Y
MLfWaaIc5WyhLFyQKW2Upofn9wSFi8ubyBnv640Dfd0rVmaWv7LNTZpoZ/GbJAMA
EQEAAYkBHwQYAQIACQUCU5ygeQIbAgAKCRDt1A0FCB6SP0zCB/sEzaVR38vpx+OQ
MMynCBJrakiqDmUZv9xtplY7zsHSQjpd6xGflbU2n+iX99Q+nav0ETQZifNUEd4N
1ljDGQejcTyKD6Pkg6wBL3x9/RJye7Zszazm4+toJXZ8xJ3800+BtaPoI39akYJm
+ijzbskvN0v/j5GOFJwQO0pPRAFtdHqRs9Kf4YanxhedB4dIUblzlIJuKsxFit6N
lgGRblagG3Vv2eBszbxzPbJjHCgVLR3RmrVezKOsZjr/2i7X+xLWIR0uD3IN1qOW
CXQxLBizEEmSNVNxsp7KPGTLnqO3bPtqFirxS9PJLIMPTPLNBY7ZYuPNTMqVIUWF
4artDmrG
=7FfJ
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
SubKey that has an invalid cross-signature
:public key packet:
  version 4, algo 1, created 1394133622, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:user ID packet: "invalid-signing-subkeys"
:signature packet: algo 1, keyid EDD40D05081E923F
  version 4, created 1402773625, md5len 0, sigclass 0x13
  digest algo 2, begin of digest 74 de
  hashed subpkt 2 len 4 (sig created 2014-06-14)
  hashed subpkt 27 len 1 (key flags: 01)
  hashed subpkt 11 len 1 (pref-sym-algos: 7)
  hashed subpkt 21 len 1 (pref-hash-algos: 8)
  hashed subpkt 30 len 1 (features: 01)
  subpkt 16 len 8 (issuer key ID EDD40D05081E923F)
  data: [2046 bits]
:public sub key packet:
  version 4, algo 1, created 1394133622, expires 0
  pkey[0]: [2048 bits]
  pkey[1]: [17 bits]
:signature packet: algo 1, keyid EDD40D05081E923F
  version 4, created 1402773625, md5len 0, sigclass 0x18
  digest algo 2, begin of digest 7b 19
  hashed subpkt 2 len 4 (sig created 2014-06-14)
  hashed subpkt 27 len 1 (key flags: 02)
  hashed subpkt 32 len 284 (signature: v4, class 0x19, algo 1, digest algo 2)
  subpkt 16 len 8 (issuer key ID EDD40D05081E923F)
  data: [2047 bits]
  -->
<textarea id="InvalidCrossSignature">
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBFMYynYBCACVOZ3/e8Bm2b9KH9QyIlHGo/i1bnkpqsgXj8tpJ2MIUOnXMMAY
ztW7kKFLCmgVdLIC0vSoLA4yhaLcMojznh/2CcUglZeb6Ao8Gtelr//Rd5DRfPpG
zqcfUo+m+eO1co2Orabw0tZDfGpg5p3AYl0hmxhUyYSc/xUq93xL1UJzBFgYXY54
QsM8dgeQgFseSk/YvdP5SMx1ev+eraUyiiUtWzWrWC1TdyRa5p4UZg6Rkoppf+WJ
QrW6BWrhAtqATHc8ozV7uJjeONjUEq24roRc/OFZdmQQGK6yrzKnnbA6MdHhqpdo
9kWDcXYb7pSE63Lc+OBa5X2GUVvXJLS/3nrtABEBAAG0F2ludmFsaWQtc2lnbmlu
Zy1zdWJrZXlziQEoBBMBAgASBQJTnKB5AhsBAgsHAhUIAh4BAAoJEO3UDQUIHpI/
dN4H/idX4FQ1LIZCnpHS/oxoWQWfpRgdKAEM0qCqjMgiipJeEwSQbqjTCynuh5/R
JlODDz85ABR06aoF4l5ebGLQWFCYifPnJZ/Yf5OYcMGtb7dIbqxWVFL9iLMO/oDL
ioI3dotjPui5e+2hI9pVH1UHB/bZ/GvMGo6Zg0XxLPolKQODMVjpjLAQ0Y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hq+3sWAck/yUtfDU9/u4eFaiNok1
8/Gd7reyuZt5CiJnpdPpjCwelK21l2w7sHAnJF55ITXdOxI8oG3BRKufz0z5lyDY
s2tXYmhhQIggdgelN8LbcMhWs/PBbtUr6uZlNJG2lW1yscD4aI529VjwJlCeo745
U7pO4eF05VViUJ2mmfoivL3tkhoTUWhx8xs8xCUcCg8DoEoSIhxtOmoTPR22Z9BL
6LCg2mg=
=Dhm4
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
<!--
Signature subpacket has an invalid length for one of its attributes
(The issuer key ID is tagged with a length of 190 bytes, but is
 only 8 bytes in reality.)
The signature packet should be discarded, which should then cause the
certificate to be rejected.
Old: Public Key Packet(tag 6)(269 bytes)
  Ver 4 - new
  Public key creation time - Sat Aug  9 16:31:45 PDT 2014
  Pub alg - RSA Encrypt or Sign(pub 1)
  RSA n(2048 bits) - ...
  RSA e(17 bits) - ...
New: User ID Packet(tag 13)(8 bytes)
  User ID - The 𝌆
Old: Signature Packet(tag 2)(296 bytes)
  Ver 4 - new
  Sig type - Positive certification of a User ID and Public Key packet(0x13).
  Pub alg - RSA Encrypt or Sign(pub 1)
  Hash alg - SHA1(hash 2)
  Hashed Sub: key flags(sub 27)(1 bytes)
    Flag - This key may be used to certify other keys
  Hashed Sub: preferred symmetric algorithms(sub 11)(1 bytes)
    Sym alg - AES with 128-bit key(sym 7)
  Hashed Sub: preferred hash algorithms(sub 21)(1 bytes)
    Hash alg - SHA256(hash 8)
  Hashed Sub: features(sub 30)(1 bytes)
    Flag - Modification detection (packets 18 and 19)
  Hashed Sub: signature creation time(sub 2)(4 bytes)
    Time - Sat Aug  9 16:31:45 PDT 2014
  Sub: issuer key ID(sub 16)(190 bytes)
    Key ID - 0x38D48534E5B68CCB
  Hash left 2 bytes - 84 16
  RSA m^d mod n(2048 bits) - ...
    -> PKCS-1
-->
<textarea id="InvalidSubpacketLength">
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mQENBFPmr2EBCACn2FimzdgSY7K1CG8M7hdz3/nQ7hHVM2ulG/WtEe6ZdlHG1mo7
i4jo2JzlAdLhnF/mZwuMJ72Wy+QUJ5Um38d6ly95RmlXPkNDz01Mb+f9YF3u36TV
o7NTIzcgK6T9kVp6ksr3IktoW3rKKFUsTkKnUuCCbl843x0uqGu3fv7JEC/AVPUt
hPNYFCttDr07p00cNbrBr8+QJXBDx//SZtCYmjrtpFP0HmARvRknx1tAun0+S9AG
AsOJLdXu8ZJPWHqwNb38J69uVk5W7dpGe0ZQdx9n9EfYXDv/wWT+8/c7YGLqCtIf
qMXW+PKdgAo5xqL4S+rqfGZHlT5y8fyIhY45ABEBAAHNCFRoZSDwnYyGiQEoBBMB
AgASAhsBAgsHAhUIAh4BBQJT5q9hAAq/EDjUhTTltozLhBYIAJYP08yoeKWk5cj0
B9Y51PEzII8fGrJDeoltJ+O1iPBteiA0Es3Q3XOXtkjqPFMzDpgjEpqAj+fSE5VC
AsGP63ozSg4zOCDF8k++/iX+t5A3i+xGTZmknisccjVdcx/1nVFBK8dEy6WE+ir9
f74GEqERKGvgLyFXlS6dXzs5J1gSY0pOq5NxYkHauz/9QIKSoxMxDad0AJbVegBX
ESFbpA5UETgojzviA6Q/jz6c0N1cHTEQD2MnTsk8xRSnRsYG6AL96f4i6cwpdV2I
CW4s/mR2ZILuKKsS6WxY8Q8AVeKMW4cXWJZO/cMwok9Gk8oZORdWr8AkVxOLfvf/
aCOr+QE=
=d3vQ
-----END PGP PUBLIC KEY BLOCK-----
</textarea>

<script>
var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall(document.title);

function getKey(id) {
  return e2e.openpgp.block.factory.parseAscii(
      document.getElementById(id).value);
}

function getUidCertifications(uid) {
  var ret = [];
  uid.forEachSignature_(function(sig) {
    if (sig.isCertificationSignature()) {
      ret.push(sig);
    }
  });
  return ret;
}

function getUidRevocations(uid) {
  var ret = [];
  uid.forEachSignature_(function(sig) {
    if (sig.signatureType ==
        e2e.openpgp.packet.Signature.SignatureType.CERTIFICATION_REVOCATION) {
      ret.push(sig);
    }
  });
  return ret;
}

function testSigningSubkey() {
  var key = getKey('SigningSubkey');
  var mainKeyId = key.keyPacket.keyId;
  var signingSubKey = key.unverifiedSubKeys_[1];
  var bindingSig = signingSubKey.bindingSignatures_.get(0);
  assertArrayEquals(mainKeyId, bindingSig.getSignerKeyId());
  assertTrue(bindingSig.embeddedSignature
      instanceof e2e.openpgp.packet.Signature);
  assertTrue(Boolean(bindingSig.attributes.KEY_FLAG_SIGN));
  var crossSignature = bindingSig.embeddedSignature;
  assertArrayEquals(signingSubKey.keyId, crossSignature.getSignerKeyId());
  assertEquals(e2e.openpgp.packet.Signature.SignatureType.PRIMARY_KEY,
      crossSignature.signatureType);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    assertEquals(2, key.subKeys.length);
    asyncTestCase.continueTesting();
  })
}

function testEmbeddedSignatures() {
  var key, error;
  // Remove embedded signature
  key = getKey('SigningSubkey');
  delete key.unverifiedSubKeys_[1].bindingSignatures_.get(0).embeddedSignature;
  asyncTestCase.waitForAsync('Waiting for signature processing to fail.');
  key.processSignatures().then(function() {
    fail('Missing embedded signature should fail');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);

    // Tamper signature type
    key = getKey('SigningSubkey');
    key.unverifiedSubKeys_[1].bindingSignatures_.get(0).embeddedSignature
        .signatureType = e2e.openpgp.packet.Signature.SignatureType.SUBKEY;
    return key.processSignatures();
  }).then(function() {
    fail('Tampered signature type should fail');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);

    // Invalidate signature
    key = getKey('SigningSubkey');
    key.unverifiedSubKeys_[1].bindingSignatures_.get(0).embeddedSignature
        .signature.s[0] ^= 0x01;
    return key.processSignatures();
  }).then(function() {
    fail('Invalid signature should fail');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);
    asyncTestCase.continueTesting();
  });
}


function testSignatureVerification() {
  var keyBlock = getKey('EccKey');
  assertEquals(1, keyBlock.unverifiedSubKeys_[0].bindingSignatures_.size());
  assertEquals(
      e2e.openpgp.packet.Signature.SignatureType.SUBKEY,
      keyBlock.unverifiedSubKeys_[0].bindingSignatures_.get(0).signatureType);
  assertArrayEquals(
      keyBlock.unverifiedSubKeys_[0].bindingSignatures_.get(0)
          .untrustedAttributes.ISSUER,
      keyBlock.keyPacket.keyId);
  // Modify the signature.
  keyBlock.unverifiedSubKeys_[0].bindingSignatures_.get(0).signature
      .s[0] ^= 0x01;

  var tamperedAscii = e2e.openpgp.asciiArmor.armorBlock(keyBlock);
  var tamperedKey = e2e.openpgp.block.factory.parseAscii(tamperedAscii);
  asyncTestCase.waitForAsync('Waiting for signature processing to fail.');
  tamperedKey.processSignatures().then(function() {
    fail('Signature tampering invalidates the key.');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);
    assertEquals(0, keyBlock.subKeys.length);
    asyncTestCase.continueTesting();
  })
}


function testGnupgRevokedSubkey() {
  // Test for https://code.google.com/p/end-to-end/issues/detail?id=60
  // GnuPG places subkey revocation signature packet right after subkey
  // packet.
  var publicKeyBlock = getKey('RevokedSubKey');

  // Parsing revocation signature
  assertEquals(1, publicKeyBlock.unverifiedSubKeys_.length);
  assertEquals(0, publicKeyBlock.subKeys.length);
  var revokedSubkey = publicKeyBlock.unverifiedSubKeys_[0];
  assertEquals(1, revokedSubkey.revocations_.size());
  assertEquals(e2e.openpgp.packet.Signature.SignatureType.SUBKEY_REVOCATION,
      revokedSubkey.revocations_.get(0).signatureType);
  assertEquals(e2e.openpgp.packet.Signature.RevocationReason.KEY_COMPROMISED,
      revokedSubkey.revocations_.get(0).attributes.REVOCATION_REASON);
  assertEquals('revoke subkey',
      revokedSubkey.revocations_.get(0).attributes.REVOCATION_REASON_TEXT);
  assertEquals(1, revokedSubkey.bindingSignatures_.size());
  // Applying revocation signature removes the revoked subkey, but the key is
  // still valid.
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  publicKeyBlock.processSignatures().then(function() {
    assertEquals(1, publicKeyBlock.unverifiedSubKeys_.length);
    assertEquals(0, publicKeyBlock.subKeys.length);

    // Tamper revocation signature
    var clone = getKey('RevokedSubKey');
    clone.unverifiedSubKeys_[0].revocations_.get(0).signature.s[0] ^= 0x01;
    var tamperedAscii = e2e.openpgp.asciiArmor.armorBlock(clone);
    var key = e2e.openpgp.block.factory.parseAscii(tamperedAscii);
    asyncTestCase.waitForAsync('Waiting for signature processing to fail.');
    return key.processSignatures();
  }).then(function() {
    fail('Signature tampering invalidates the key.');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);
    asyncTestCase.continueTesting();
  });
}


function testGnupgRevokedMainKey() {
  var publicKeyBlock = getKey('RevokedMainKey');

  assertEquals(1, publicKeyBlock.keyPacket.revocations_.size());
  assertEquals(e2e.openpgp.packet.Signature.SignatureType.KEY_REVOCATION,
      publicKeyBlock.keyPacket.revocations_.get(0).signatureType);
  assertEquals(e2e.openpgp.packet.Signature.RevocationReason.KEY_COMPROMISED,
      publicKeyBlock.keyPacket.revocations_.get(0).attributes.REVOCATION_REASON);
  assertEquals('Main key revocation test',
      publicKeyBlock.keyPacket.revocations_.get(0).attributes.REVOCATION_REASON_TEXT);
  asyncTestCase.waitForAsync('Waiting for signature processing to fail.');
  // The whole key is revoked, so this fails
  publicKeyBlock.processSignatures().then(function() {
    fail('Key is revoked');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);

    // Tamper revocation signature
    publicKeyBlock.keyPacket.revocations_.get(0).signature.s[0] ^= 0x01;
    var tamperedAscii = e2e.openpgp.asciiArmor.armorBlock(publicKeyBlock);
    var key = e2e.openpgp.block.factory.parseAscii(tamperedAscii)
    return key.processSignatures();
  }).then(function() {
    fail('signature processing should fail on a tampered key');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);
    asyncTestCase.continueTesting();
  });
}


function testGnupgRevokedUid() {
  var key = getKey('RevokedUserId');
  var foreignKeyId = [106, 105, 167, 16, 15, 140, 92, 71];
  assertEquals(2, key.unverifiedUserIds_.length);
  assertEquals(0, key.userIds.length);

  // Helper function - checks that all the signatures for a given
  // keyid in the uid signature map are in fact issued by the
  // keyid. Also returns a count of the number of certification
  // and revocation signatures for that keyid.
  var checkUidMap = function(uid, keyid) {
    var keyidString = e2e.openpgp.packet.UserId.keyIdToString_(keyid);
    var arr = uid.keyIdSignatureMap_[keyidString];
    var result = { certificationCount: 0, revocationCount: 0};
    for (var i = arr.size() - 1; i >= 0; i--) {
      var signature = arr.get(i);
      assertArrayEquals(keyid, signature.getSignerKeyId());
      if (signature.isCertificationSignature()) {
        result.certificationCount++;
      } else {
        assertEquals(
          e2e.openpgp.packet.Signature.SignatureType.CERTIFICATION_REVOCATION,
          signature.signatureType);
        result.revocationCount++;
      }
    }
    return result;
  };

  // revoked-userid should have one certification, one revocation
  // signature from the primary key, and one certification
  // from the foreign key.
  var result = checkUidMap(key.unverifiedUserIds_[0], key.keyPacket.keyId);
  assertEquals(1, result.certificationCount);
  assertEquals(1, result.revocationCount);
  result = checkUidMap(key.unverifiedUserIds_[0], foreignKeyId);
  assertEquals(1, result.certificationCount);
  assertEquals(0, result.revocationCount);


  // non-revoked-uid should have one signature from the primary key,
  // and one from the foreign key.
  result = checkUidMap(key.unverifiedUserIds_[1], key.keyPacket.keyId);
  assertEquals(1, result.certificationCount);
  assertEquals(0, result.revocationCount);
  result = checkUidMap(key.unverifiedUserIds_[1], foreignKeyId);
  assertEquals(1, result.certificationCount);
  assertEquals(0, result.revocationCount);

  // Apply signatures
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    assertEquals(1, key.userIds.length);
    assertEquals('non-revoked-uid <non-revoked-uid@example.com>',
                 key.userIds[0].userId);
    result = checkUidMap(key.userIds[0], key.keyPacket.keyId);
    assertEquals(1, result.certificationCount);
    assertEquals(0, result.revocationCount);
    result = checkUidMap(key.userIds[0], foreignKeyId);
    assertEquals(1, result.certificationCount);
    assertEquals(0, result.revocationCount);

    // Check that signature tampering is detected
    key = getKey('RevokedUserId');

    var revocations = getUidRevocations(key.unverifiedUserIds_[0]);
    revocations[0].signature.s[0] ^= 0x01;

    return key.processSignatures();
  }).then(function() {
    fail('signature tampering was not detected');
  }, function(error) {
    // Check that signatures by unknown keys are ignored.
    key = getKey('RevokedUserId');
    revocations = getUidRevocations(key.unverifiedUserIds_[0]);
    revocations[0].untrustedAttributes.ISSUER[0] ^= 0x01;
    return key.processSignatures();
  }).then(function() {
    assertEquals(2, key.userIds.length);
    asyncTestCase.continueTesting();
  });
};

function testGnupgUserAttr() {
  var key = getKey('UserAttr');
  assertEquals(0, key.userIds.length);
  assertEquals(0, key.userAttributes.length);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    assertEquals(1, key.userIds.length);
    assertEquals(1, key.userAttributes.length);
    key.userAttributes[0].keyIdSignatureMap_ = {};
    // Lack of certification removes User Attribute, but does not throw error.
    return key.processSignatures();
  }).then(function() {
  assertEquals(0, key.userAttributes.length);
    // Tampering would throw an error though
    key = getKey('UserAttr');
    key.unverifiedUserAttributes_[0].data[0] ^= 0x01;
    return key.processSignatures();
  }, fail).then(function() {
    fail('tampering was not detected');
  }, function(error) {
    assertTrue(error instanceof e2e.openpgp.error.SignatureError);
    assertEquals(0, key.userAttributes.length);
    asyncTestCase.continueTesting();
  });
};

function testKeyUsageFlags() {
  var key = getKey('GnuPgKeyUsageFlags');
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    assertObjectEquals(key.subKeys[1], key.getKeyToEncrypt());
    asyncTestCase.continueTesting();
  });
}

function testSignOnlyPublicKey() {
  var key = getKey('SignOnlyPublicKey');
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    // primary key/userid on this key should not sign or encrypt.
    assertEquals(1, key.userIds.length);
    assertEquals(1418654084, key.userIds[0].getCertifiedTime(key.keyPacket));
    assertFalse(key.userIds[0].isCertifiedTo(
        key.keyPacket, e2e.openpgp.packet.Key.Usage.ENCRYPT));
    assertFalse(key.userIds[0].isCertifiedTo(
        key.keyPacket, e2e.openpgp.packet.Key.Usage.SIGN));


    // The single subkey on this key can only sign.
    assertEquals(1, key.subKeys.length);
    assertEquals(1418654101, key.subKeys[0].getCertifiedTime(key.keyPacket));
    assertTrue(key.subKeys[0].isCertifiedTo(
        key.keyPacket, e2e.openpgp.packet.Key.Usage.SIGN));
    assertFalse(key.subKeys[0].isCertifiedTo(
        key.keyPacket, e2e.openpgp.packet.Key.Usage.ENCRYPT));

    // Verify the getter methods return the correct (or no) subkey.
    assertNull(key.getKeyToEncrypt());
    assertEquals(
        key.subKeys[0],
        key.getKeyTo(
            e2e.openpgp.packet.Key.Usage.SIGN, e2e.openpgp.packet.PublicKey));

    asyncTestCase.continueTesting();
  });
}

function testSubkeyOnlySecretKey() {
  var key = getKey('SubkeyOnlySecretKey');
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    // primary key/userid on this key should not sign or encrypt.
    assertEquals(1, key.userIds.length);
    assertFalse(key.userIds[0].isCertifiedTo(
        key.keyPacket, e2e.openpgp.packet.Key.Usage.ENCRYPT));
    assertFalse(key.userIds[0].isCertifiedTo(
        key.keyPacket, e2e.openpgp.packet.Key.Usage.SIGN));

    // Get the appropriate subkey when asked.
    var subkey = key.getKeyToSign();
    assertArrayEquals(
        [0xA5, 0x44, 0xCE, 0x2D, 0xFD, 0xAF, 0x0B, 0x58], subkey.keyId);
    subkey = key.getKeyTo(
        e2e.openpgp.packet.Key.Usage.ENCRYPT, e2e.openpgp.packet.SecretKey);
    assertArrayEquals(
        [0x13, 0x89, 0xA7, 0x8D, 0x42, 0x06, 0xE4, 0xCD], subkey.keyId);

    asyncTestCase.continueTesting();
  });
}

function testDSADSADefaultKeyUsage() {
  var key = getKey('DSADSADefaultKeyUsage');

  function assertNoKeyFlags(immutableArray) {
    assertTrue(immutableArray.state_);
    assertEquals(1, immutableArray.elements_.length);
    var signature = immutableArray.elements_[0];
    assertFalse(signature.attributes.hasOwnProperty('KEY_FLAGS'));
  }

  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    // No explict usage flags on the primary or subkey.
    assertEquals(1, key.userIds.length);
    assertNoKeyFlags(key.userIds[0].keyIdSignatureMap_['b471d19456481c9a']);
    assertEquals(1, key.subKeys.length);
    assertNoKeyFlags(key.subKeys[0].bindingSignatures_);

    // The subkey should be selected for signing
    assertEquals(key.subKeys[0], key.getKeyToSign());

    // No key should be selected for encryption
    assertNull(
        key.getKeyTo(
            e2e.openpgp.packet.Key.Usage.ENCRYPT, e2e.openpgp.packet.SecretKey));

    asyncTestCase.continueTesting();
  });
}


function testRSARSADefaultKeyUsage() {
  var key = getKey('RSARSADefaultKeyUsage');
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    // No explict usage flags on the primary or subkey, but
    // algorithm ids carry usage information.
    assertEquals(1, key.userIds.length);
    assertEquals(1, key.subKeys.length);

    // The subkey should be selected for encryption
    assertEquals(key.subKeys[0], key.getKeyToEncrypt());

    // The primary key should be selected for signing-related stuff
    assertEquals(
        key.keyPacket,
        key.getKeyTo(
            e2e.openpgp.packet.Key.Usage.SIGN, e2e.openpgp.packet.PublicKey));

    asyncTestCase.continueTesting();
  });
}

function testExpiredUid() {
  var key = getKey('ExpiredUid');
  assertEquals(2, key.unverifiedUserIds_.length);
  assertEquals(0, key.userIds.length);
  assertEquals(86400, getUidCertifications(key.unverifiedUserIds_[0])[0]
      .attributes.SIGNATURE_EXPIRATION_TIME);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    // Expired User ID gets rejected
    assertEquals(2, key.unverifiedUserIds_.length);
    assertEquals(1, key.userIds.length);

    assertEquals('good-key', key.userIds[0].userId);
    asyncTestCase.continueTesting();
  });
}

function testValidUid() {
  var key = getKey('ValidUid');
  assertEquals(1, key.unverifiedUserIds_.length);
  assertEquals(0, key.userIds.length);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    assertEquals(1, key.unverifiedUserIds_.length);
    assertEquals(1, key.userIds.length);
    assertEquals('should-not-expire', key.userIds[0].userId);
    // Only the latest certification signature should remain.
    assertEquals(1, key.userIds[0].keyIdSignatureMap_['57cc7cb355ba0491'].size());
    asyncTestCase.continueTesting();
  });
}

function testRevokedUid() {
  var key = getKey('RevokedUid');
  assertEquals(2, key.unverifiedUserIds_.length);
  assertEquals(0, key.userIds.length);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    assertEquals(1, key.userIds.length);
    assertEquals('good', key.userIds[0].userId);
    asyncTestCase.continueTesting();
  });
}

function testExpiredSubkey() {
  var key = getKey('ExpiredSubkey');
  assertEquals(1, key.unverifiedSubKeys_.length);
  assertEquals(0, key.subKeys.length);
  assertEquals(86400, key.unverifiedSubKeys_[0].bindingSignatures_.get(0)
      .attributes.SIGNATURE_EXPIRATION_TIME);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  key.processSignatures().then(function() {
    // Expired User ID gets rejected
    assertEquals(1, key.unverifiedSubKeys_.length);
    assertEquals(0, key.subKeys.length);
    asyncTestCase.continueTesting();
  });
}

function testBadSubkeys() {
  var e = assertThrows(function() {
    getKey('MissingCrossSignature')
  });
  assertTrue(e instanceof e2e.openpgp.error.ParseError);
  assertEquals(e.message, 'Missing required key cross-signature.');
  var key = getKey('InvalidCrossSignature');
  asyncTestCase.waitForAsync('Waiting for signature processing to fail.');
  key.processSignatures().then(function() {
    fail('Missing required key cross-signature.  Should fail');
  }, function(e) {
    assertTrue(e instanceof e2e.openpgp.error.SignatureError);
    assertEquals(e.message, 'Cross-signature verification failed.');
    asyncTestCase.continueTesting();
  });
}

function testInvalidSubpacketLength() {
  var data = e2e.openpgp.asciiArmor.parse(
    document.getElementById('InvalidSubpacketLength').value);
  var keys = e2e.openpgp.block.factory.parseByteArrayAllTransferableKeys(
    data.data, true);
  assertEquals(keys.length, 1);
  asyncTestCase.waitForAsync('Waiting for signature processing to fail.');
  keys[0].processSignatures().then(function() {
    fail('Invalid subpacket length.  Should fail');
  }, function(e) {
    assertTrue(e instanceof e2e.openpgp.error.SignatureError);
    assertEquals(e.message, 'No certified user IDs.');
    asyncTestCase.continueTesting();
  });
}

function testAddUnverifiedPackets() {
  var keyBlock = getKey('EccKey');
  assertEquals(0, keyBlock.userIds.length);
  assertEquals(0, keyBlock.subKeys.length);
  assertEquals(1, keyBlock.unverifiedUserIds_.length);
  assertEquals(1, keyBlock.unverifiedSubKeys_.length);
  keyBlock.addUnverifiedUserId(new e2e.openpgp.packet.UserId('userid'));
  assertEquals(2, keyBlock.unverifiedUserIds_.length);
  assertEquals(0, keyBlock.userIds.length);
  keyBlock.addUnverifiedSubKey(new e2e.openpgp.packet.PublicSubkey(4, 1,
    keyBlock.unverifiedSubKeys_[0].cipher));
  assertEquals(2, keyBlock.unverifiedSubKeys_.length);
  assertEquals(0, keyBlock.subKeys.length);
  asyncTestCase.waitForAsync('Waiting for signature processing.');
  keyBlock.processSignatures().then(function() {
    assertEquals(1, keyBlock.userIds.length);
    assertEquals(1, keyBlock.subKeys.length);
    assertEquals(2, keyBlock.unverifiedUserIds_.length);
    assertEquals(2, keyBlock.unverifiedSubKeys_.length);
    asyncTestCase.continueTesting();
  });
}

</script>
